/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved. 
 */
package com.icinfo.cloud.provider.punish.config.controller;

import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.config.dto.ConfigPaymentSourceBaseinfoDto;
import com.icinfo.cloud.provider.punish.config.model.ConfigPaymentSourceBaseinfo;
import com.icinfo.cloud.provider.punish.config.service.IConfigPaymentSourceBaseinfoService;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 描述: 支付基础信息同步表 config_payment_source_baseinfo 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2023年02月17日
 */
@RestController
@RefreshScope
@RequestMapping("/punish/config/payment/source")
@Slf4j
public class ConfigPaymentSourceBaseinfoController extends BaseController {
    /**
     * 日志记录器
     */
    private static final Logger logger = LoggerFactory.getLogger(ConfigPaymentSourceBaseinfoController.class);

    @Autowired
    private IConfigPaymentSourceBaseinfoService configPaymentSourceBaseinfoService;


    /**
     * 【V1.11.0】描述：根据参数获取公共支付基础信息-来自支付平台
     */
    @PostMapping("/getConfigPaymentSourceInfoByParam")
    @ApiOperation(value = "【V1.11.0】描述：根据参数获取公共支付基础信息-来自支付平台", httpMethod = "POST")
    public Result<List<ConfigPaymentSourceBaseinfo>> getConfigPaymentSourceInfoByParam(@RequestBody ConfigPaymentSourceBaseinfoDto queryDto) {
        List<ConfigPaymentSourceBaseinfo> list = configPaymentSourceBaseinfoService.doGetConfigPaymentSourceInfoByParam(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, list);
    }

    /**
     * 【V1.11.0】描述：支付基础信息同步
     *
     * @return {@link Result <String>} 保存结果
     * @author xiangyuyu
     * @date 2022-03-02 15:23
     */
    @PostMapping("/sourceBaseInfoSync")
    public Result<String> sourceBaseInfoSync() {
        configPaymentSourceBaseinfoService.syncPaymentBaseInfoListBatch("330000022");
        return Result.success("操作成功");
    }
}